"""
file: app1.py
This application relies on Gunicorn to run 
"""

from flask import Flask, request

from werkzeug.contrib.fixers import ProxyFix # for running Gunicorn
app = Flask(__name__)

@app.route("/")
def contents_by_year():
    if request.args.get('year'):
        byyear = "contents for year " + str(request.args.get('year'))
    else:
        byyear = "contents for year x - not given"
    return byyear

@app.route("/summary")
def summary():
    return "summary of contents"

app.wsgi_app = ProxyFix(app.wsgi_app) # for running Gunicorn

if __name__ == "__main__":
    # run as externally visible server
    app.run(host='0.0.0.0')
